using System;
using System.Windows.Forms;

namespace SCSFContrib.DemoWorkshop.Infrastructure.Module
{
	public partial class AboutView : UserControl, IAboutView
	{
		public AboutView()
		{
			InitializeComponent();
			urlScsfContrib.Click += Url_Click;
		}

		protected override void OnLoad(EventArgs e)
		{
			_presenter.OnViewReady();
			base.OnLoad(e);
		}

		void IAboutView.FillContributorsBox()
		{
			AddTitle();
			AddBody();
		}

		private void AddTitle()
		{
			rtxtContributors.SelectionAlignment = _presenter.TitleAlignment;
			rtxtContributors.SelectionColor = _presenter.TitleColor;
			rtxtContributors.SelectionFont = _presenter.TitleFont;
			rtxtContributors.SelectedText = _presenter.TitleText;
		}

		private void AddBody()
		{
			rtxtContributors.SelectionColor = _presenter.TextColor;
			rtxtContributors.SelectionFont = _presenter.TextFont;
			rtxtContributors.SelectedText  = _presenter.CreateContributorText();
		}

		string IAboutView.ScsfUrl
		{
			get { return urlScsfContrib.Text; }
		}

		void Url_Click(object sender, EventArgs e)
		{
			_presenter.NavigateToWebSite();
		}
	}
}

